package com.lzw.mall.order.controller;

import com.lzw.mall.common.service.ICategoryService;
import com.lzw.mall.common.vo.CategoryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/")
public class IndexController {

    @Autowired
    private ICategoryService categoryService;


    @GetMapping("/")
    public String index(Model model) {
        List<CategoryVO> categorys=categoryService.indexList();
        System.out.println(categorys);
        model.addAttribute("categorys",categorys);
        System.out.println("zhuye");
        return "index";
    }
    /*@GetMapping("/categorys")
    @ResponseBody
    public List<CategoryVO> categories(){
        return categoryService.indexList();
    }*/
    @GetMapping("/aaaaa")
    public String aaaaa(){
        return "aaaaa";
    }

}
